import { useState, useEffect } from 'react';
import './XiaoXiTop.css'
import axios from 'axios'
interface DataItem {
  id: number;
  title: string;
  time: string;
}
function In_siteNotification() {
const [data, setData] = useState<DataItem[]>([]);
     useEffect(() => {
        axios.get('http://localhost:3000/api/data')
        .then(response => {
            setData(response.data.list);
        })
        .catch(error => console.error('Error fetching data:', error));
  }, []);
  return (
    <div className='allMessages_content'>
            {data.map(item => (
                <div key={item.id} className="allMessages_content_list">
                     <dt><img src="" alt="" /></dt>
                <dd>{item.title}
                <p>站内通知 |{item.time}</p></dd>
                
                </div>
            ))}
    </div>
  )
}

export default In_siteNotification
